// 虚拟dom和Diff算法的展示

import React from 'react'
import ReactDOM from 'react-dom'

class App extends React.PureComponent {


    state = {
        number: 0
    }

    handlerClick = () => {
        this.setState(() => {
            return {
                number: this.state.number + 1
            }
        })
    }
    render() {
        const el =(
            <div>
                <h1>获取随机数：{this.state.number}</h1>
                <button onClick={this.handlerClick}>更新随机数</button>
            </div>
        )

        // 这个el打印出来就是一个虚拟的对象
        console.log(el);
        return el 
    }
}

ReactDOM.render(<App />, document.getElementById('root'))